<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
<title>Yogette's CheckOut Page</title>

        <style type="text/css">
            #sortable1 { list-style-type: none; margin: 0; padding: 0; width: 60%; }
            #sortable1 tr { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
            #sortable1 tr span { position: absolute; margin-left: -1.3em; }
            #sortable2 { list-style-type: none; margin: 0; padding: 0; width: 60%; }
            #sortable2 tr { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
            #sortable2 tr span { position: absolute; margin-left: -1.3em; }
        </style>
        
<link href="<?php echo base_url(); ?>/yogette/css/style.css" rel="stylesheet" type="text/css" />
<link href="<?php echo base_url(); ?>/yogette/css/yogette.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<?php echo base_url(); ?>/yogette/js/HW8-2.js"></script>
    </head>

    <body id="blog_entry" class="body-user">
         
        <div class="main-wrapper-blog" style=" height:auto; position:absolute ; " >
            <img class="pinkcircle" src="<?php echo base_url(); ?>yogette/images/pinkCircle.jpg"/>
            <div class="Container"></div>
            <div class="menulist">
                <ul class="menulist-ul">
                    <li><img class="ice-cream" src="<?php echo base_url(); ?>yogette/images/logoIcon.jpg"/><a href="/yogette/member"><img src="<?php echo base_url(); ?>yogette/images/mainboard.jpg" class="home" alt="Yogette's Homepage"/></a></li>
                </ul>
            </div>
            <div style=" margin-left: 70.5%;">
                <?php if (!$this->session->userdata('c_logged_in')) { ?>
                    |-| <a class="metadata-blog-div-a" href="/yogette/user/login">Login</a> |-|
                <?php } ?>
                <?php if ($this->session->userdata('c_logged_in')) { ?>
                    |-| <a class="metadata-blog-div-a" href="/yogette/cart/logout">LogOut</a> |-|
                <?php } ?>
            </div>
            
            <div class="content" style="margin-top: 6em ">
            
               <div class="blog-div-th" style="text-align: center; margin-top: 0em">Your Cart Items</div>
            
                        <!-- check if there is movies queue list and print it or not and print the error -->
                        <div class="data" style ="text-align: center; margin: 0em 10em 10em 12em;" >
                         <?php $total = 0 ;?>
                           <?php
                             
                            if ($items == false) {
                                ?> 
                                        <table style="margin-left: 25em;  " cellspacing="0" cellpadding="4" border="4">
                                            <thead>
                                                <tr>
                                                <td><h1>Result</h1></td>
                                                </tr>
                                            </thead>
                                            <tbody id="sortable1">
                                                <tr>
                                                <td><h1>You don't have any Cart Items</h1></td>
                                                </tr>
                                            </tbody>
                                        </table>
                        </div>
                        <?php } else { ?>
                         <?php $total = 0 ;?>
                        <div class="data" style ="text-align: center; margin: 0em 10em 10em 8em;  ">   
                            <table cellspacing="1" cellpadding="4" border="4">
                                <thead>
                                <tr>
                                <td>Product ID</td>
                                <td>Product Name</td>
                                <td>Product Description</td>
                                <td>Product Price</td>
                                <td>Product Tax</td>
                                <td>Menu Type</td>
                                <td>Product Image</td>
                                <?php if ($this->session->userdata('c_logged_in')) { ?> 
                                <td>Actions</td>
                                 <?php } ?>
                                </tr>
                                </thead>
                                <tbody id="sortable1">
                                    <?php
                                    foreach ($items as $items) {
                                    $prod_id = $items['prod_id'];
                                    echo "<tr id='item_$prod_id' class='ui-state-default'>"; ?>
                                        <td><?php echo $items['prod_id'] ?></td>
                                        <td><?php echo $items['p_name'] ?></td>
                                        <td><?php echo $items['p_description'] ?></td>
                                        <td id="p_price"><?php echo $items['p_price'] ?></td>
                                        <td id="p_tax"><?php echo $items['p_tax'] ?></td>
                                         <?php $total = $total + $items['p_price'] ;?>
                                         <?php $total = $total + $items['p_tax'] ;?>
                                        <td><?php echo $items['m_type'] ?></td>
                                        <td><a href="<?php echo base_url(); ?>yogette/images/<?php echo $items['p_images']; ?>"
                                              class="nyroModal" ><img src="<?php echo base_url(); ?>yogette/images/<?php echo $items['p_images'];?>"
                                              class="showme3" width="40" height="40" alt="" id="showme"/></a></td>
                                       <?php if ($this->session->userdata('c_logged_in')) { ?> 
                                        <td><?php echo anchor('yogette/cart/remove_cart/' . 
                                                $items['order_id'] , 'Remove', array('class' => 'remove')); ?>
                                        </td>
                                        <?php } ?>
                                    <?php echo "</tr>"; } ?>
                                </tbody>
                            </table>
                         </div>   
                           <?php } ?>                
            </div>
            
            <div class="content" style="margin-top: 6em ">
            
               <div class="blog-div-th" style="text-align: center; margin-top: 0em">Your Reservations</div>
            
                        <!-- check if there is movies queue list and print it or not and print the error -->
                        <div class="data" style ="text-align: center; margin: 0em 10em 10em 11em;" >
                            <?php
                            if ($reserv == false) {
                                ?> 
                                        <table style="margin-left: 25em;  " cellspacing="0" cellpadding="4" border="4">
                                            <thead>
                                                <tr>
                                                <td><h1>Result</h1></td>
                                                </tr>
                                            </thead>
                                            <tbody id="sortable1">
                                                <tr>
                                                <td><h1>You don't have any Reservations</h1></td>
                                                </tr>
                                            </tbody>
                                        </table>
                        </div>
                        <?php } else { ?>
                        <div class="data" style ="text-align: center; margin: 0em 5em 5em 6em;  ">   
                            <table cellspacing="1" cellpadding="4" border="4">
                                <thead>
                                <tr>
                                <td>Reserve ID</td>
                                <td>Reserve Date</td>
                                <td>Reserve Time Start</td>
                                <td>Reserve Time End</td>
                                <td>Special Type</td>
                                <td>Special Description</td>
                                <td>Special Price</td>
                                <td>Store Location</td>
                                <?php if ($this->session->userdata('c_logged_in')) { ?> 
                                <td>Action</td>
                                 <?php } ?>
                                </tr>
                                </thead>
                                <tbody id="sortable1">
                                    <?php
                                    foreach ($reserv as $item) {
                                    $reserv_id = $item->reserv_id;
                                    echo "<tr id='item_$reserv_id' class='ui-state-default'>"; ?>
                                        <td><?php echo $item->reserv_id; ?></td>
                                        <td><?php echo $item->reserv_date; ?></td>
                                        <td><?php echo $item->reserv_time_start; ?></td>
                                        <td><?php echo $item->reserv_time_end; ?></td>
                                        <td><?php echo $item->spe_type; ?></td>
                                        <td><?php echo $item->special_desc; ?></td>
                                        <td id="spe_price" value="<?php echo $item->spe_price; ?>"><?php echo $item->spe_price; ?></td>
                                         <?php $total = $total + $item->spe_price ;?>
                                        <td><?php echo $item->store_loc; ?></td>  
                                       <?php if ($this->session->userdata('c_logged_in')){ ?> 
                                        <td><?php echo anchor('yogette/reserve/cancel_reservation/'.$item->reserv_id , 
                                                'Cancel-Reservation', array('class' => 'Delete')); ?>
                                        </td>
                                        <?php } ?>
                                    <?php echo "</tr>"; } ?>
                                        
                                </tbody>
                            </table>
                         </div>   
                           <?php } ?>                
            </div>
        </div>
        <div style="margin: 0em 5em 5em 35em;"> <!--Calculating the Price-->
            <label>TOTAL:</label>
            <input type="text" id="total"value="<?php echo $total;?>" disabled="disabled" />
        </div>
        <div style="margin: -5em -5em -3em 38em;"> <!--Calculating the Price-->
         <?php echo form_open(base_url() . 'yogette/user/submit_payment'); ?>  
            <input type="hidden" name="totalhidden" id="totalhidden" 
            value="<?php echo $total; ?>" />
            <?php echo form_submit(array('name' => 'submit'), 'Submit Payment'); ?>
            <?php echo form_close(); ?>
        </div>
                
        <!-- footer start -->
        <div class="pre-footer">   
        </div>
        <div class="footer">
            <div>
                <p class="footer-p1">yogurt is healthy</p>
            </div>
            <div>
                <p class="footer-p2">Copyright &COPY; 2010 YOGETTE.</p>
            </div>
        </div>
        <img class="post-footer" src="<?php echo base_url(); ?>yogette/blank.jpg" id="blank" name="blank" /> 
        <!-- footer ends-->

    </body>
</html>